/*
 * @Descripttion:
 * @version:
 * @Author: sueRimn
 * @Date: 2020-10-30 15:29:40
 * @LastEditors: sueRimn
 * @LastEditTime: 2020-11-10 14:01:04
 */
import request from '@/utils/request'
import store from '@/store/index'
const base = require('../../env/index')

// 夹带k_token
function addK_Token(data) {
    var token = {
        k_token: store.getters.k_token
    }
    Object.assign(data, token)
    return data
}

/**
 * 获取模块列表
 */
export function get_moduleList(data) {
    return request({
        url: base.permission_url + '/api/v1/admin/module/infos',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 获取机构模块权限
 */
export function get_mechanismAuth(data) {
    return request({
        url: base.permission_url + '/api/v1/admin/external/info',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 赋予机构模块权限
 */
export function set_mechanismAuth(data) {
    return request({
        url: base.permission_url + '/api/v1/admin/external/save',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 修改机构模块权限
 */
export function edit_mechanismAuth(data) {
    return request({
        url: base.permission_url + '/api/v1/admin/external/update',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 获取机构模块页面权限
 */
export function get_pageAuth(data) {
    return request({
        url: base.permission_url + '/api/v1/admin/auth/infos',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 新增机构模块页面权限
 */
export function add_pageAuth(data) {
    return request({
        url: base.permission_url + '/api/v1/admin/auth/save',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
/**
 * 删除机构模块页面权限
 */
export function delect_pageAuth(data) {
    return request({
        url: base.permission_url + '/api/v1/admin/auth/delete/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
